
package de.swta.freezay;

import org.apache.wicket.Request;
import org.apache.wicket.protocol.http.WebSession;

/**
 * The FreezaySession implements a simple login/logout behavior
 *
 * @author Jan Korreck
 * @author Christian Baeumer
 */
public class FreezaySession extends WebSession {

    /** The admin-password */
    private static final String ADMIN_PASSWORD = "admin";
    /** TURE if admin is logged in */
    private boolean loggedIn;

    
    /**
     * Constructor
     *
	 * @param request the current request
     */
    public FreezaySession(Request request) {
        super(request);
        loggedIn = false;
    }


    /**
     * Try to login with the specified password
     *
     * @param password the password to use
     */
    public void login(String password) {
        loggedIn = password.equals(ADMIN_PASSWORD);
    }


    /**
     * Returns TRUE if admin is logged in
     *
     * @return TRUE if admin is logged in
     */
    public boolean isLoggedIn() {
        return loggedIn;
    }


    /**
     * Logout admin (if logged in)
     */
    public void logout() {
        loggedIn = false;
    }
}
